package cn.stylefeng.guns.modular.single.controller;

import cn.stylefeng.guns.modular.single.Param.PatientEscalationParam;
import cn.stylefeng.guns.modular.single.Param.PatientParam;
import cn.stylefeng.guns.modular.single.entity.DiseaseType;
import cn.stylefeng.guns.modular.single.entity.Patient;
import cn.stylefeng.guns.modular.single.entity.PatientEscalation;
import cn.stylefeng.guns.modular.single.service.PatientEscalationService;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import com.alibaba.fastjson.JSONObject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@ApiResource(
        name = "病种上报的接口"
)
public class PatientEscalationController {
    @Resource
    private PatientEscalationService service;
    @GetResource(
            name = "患者列表",
            path = {"/drags-manage/page"}
    )
    public ResponseData<PageResult<PatientEscalation>> page(@Validated({BaseRequest.page.class}) PatientParam patientParam) {
        return new SuccessResponseData<>(this.service.findPage(patientParam));
    }

    @PostResource(
            name = "编辑参数配置",
            path = {"/drags-manage/save"}
    )
    public ResponseData<?> save(@RequestBody PatientEscalationParam param, HttpServletRequest request) {
        this.service.save(param);
        return new SuccessResponseData<>();
    }

}
